﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Home.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Site.ViewModels.ProjectIndexModels>" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>
<%@ Import Namespace="SDT.Lib.Paging" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%= ViewData["Keyword"]%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%if (Model.Projects != null && Model.Projects.Count > 0)
      {
          var first = Model.Projects[0]; %>
    <div class="prj_list">
        <div class="componentheading">
            <h2>
                TAG:
                <%= ViewData["Keyword"]%></h2>
        </div>
        <div class="leading">
            <div class="leading-left">
                <a href="/project/details/<%=first.ID %>/<%=Html.ToUrlFriendly(first.Title)%>">
                    <% string imgPath = (first.ImagePath != null && first.ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(first.ID, 214, 150, first.ImagePath, Model.ImagePath, Model.ImageUrl) : SDT.Lib.Common.Globals.DefaultLogo; %>
                    <img src="<%=imgPath %>" title="<%=first.Title %>" alt="<%=first.Title %>" class="bor_img"
                        width="214" height="150" style="overflow: hidden" />
                </a>
            </div>
            <div class="leading-right">
                <h3>
                    <a class="contentpagetitle" href="/project/details/<%=first.ID %>/<%=Html.ToUrlFriendly(item.Title)%>">
                        <%=Html.Encode(first.Title)%>
                    </a>
                </h3>
                <div>
                    <label>
                        Chủ đầu tư</label>:
                    <%var f = first.ProjectCompanyMaps.Where(e => e.TypeID == SDT.Lib.Common.ProjectCompanyListType.Investors).ToList();
                      if (f.Count > 0)
                      {
                          Response.Write(Html.Encode(f[0].Company.Name));
                      }
                    %>
                </div>
                <div>
                    <label>
                        Đơn vị giám sát</label>:
                    <%var fm = first.ProjectCompanyMaps.Where(e => e.TypeID == SDT.Lib.Common.ProjectCompanyListType.Monitoring).ToList();
                      if (fm.Count > 0)
                      {
                          Response.Write(Html.Encode(fm[0].Company.Name));
                      }
                    %>
                </div>
                <div>
                    <label>
                        Địa chỉ</label>:
                    <%=Html.Encode(first.Address)%>
                </div>
                <div>
                    <label>
                        Quy mô</label>:
                    <%=Html.Encode(first.Scale)%>
                </div>
                <div>
                    <label>
                        Vốn đầu tư</label>:
                    <%=Html.Encode(first.Investment)%>
                    &nbsp;<%=Html.Encode(first.InvestmentUnit)%>
                </div>
            </div>
            <div style="display: block; overflow: hidden; width: 680px;">
                <strong>Mô tả</strong>:
                <%=Html.Encode(first.Summary)%></div>
        </div>
        <% for (int i = 1; i < Model.Projects.Count; i++)
           {
               string imgPath1 = (Model.Projects[i].ImagePath != null && Model.Projects[i].ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(Model.Projects[i].ID, 130, 110, Model.Projects[i].ImagePath, Model.ImagePath, Model.ImageUrl) : SDT.Lib.Common.Globals.DefaultLogo;
        %>
        <div class="item">
            <div class="blog-left">
                <a href="/project/details/<%=Model.Projects[i].ID %>/<%=Html.ToUrlFriendly(Model.Projects[i].Title)%>">
                    <img class="bor_img" src="<%=imgPath1 %>" title="<%=Model.Projects[i].Title %>" alt="<%=Model.Projects[i].Title %>"
                        width="130" height="110" /></a>
            </div>
            <div class="blog-right">
                <h3>
                    <a href="/project/details/<%=Model.Projects[i].ID %>/<%=Html.ToUrlFriendly(Model.Projects[i].Title)%>">
                        <%=Html.Encode(Model.Projects[i].Title)%>
                    </a>
                </h3>
                <div>
                    <label>
                        Chủ đầu tư</label>:
                    <%var c = Model.Projects[i].ProjectCompanyMaps.Where(e => e.TypeID == SDT.Lib.Common.ProjectCompanyListType.Investors).ToList();
                      if (c.Count > 0)
                      {
                          Response.Write(Html.Encode(c[0].Company.Name));
                      }
                    %>
                </div>
                <div>
                    <label>
                        Đơn vị giám sát</label>:
                    <%var m = Model.Projects[i].ProjectCompanyMaps.Where(e => e.TypeID == SDT.Lib.Common.ProjectCompanyListType.Monitoring).ToList();
                      if (m.Count > 0)
                      {
                          Response.Write(Html.Encode(m[0].Company.Name));
                      }
                    %>
                </div>
                <div>
                    <label>
                        Địa chỉ</label>:
                    <%=Html.Encode(Model.Projects[i].Address)%>
                </div>
                <div>
                    <label>
                        Quy mô</label>:
                    <%=Html.Encode(Model.Projects[i].Scale)%>
                </div>
                <div>
                    <label>
                        Vốn đầu tư</label>:
                    <%=Html.Encode(Model.Projects[i].Investment)%>
                    &nbsp;<%=Html.Encode(Model.Projects[i].InvestmentUnit)%>
                </div>
            </div>
        </div>
        <%} %>
    </div>
    <div class="pagebarUTH f_r">
        Trang
        <%= Model.Projects.PageNumber%>/<%= Model.Projects.PageCount%>
        <%= Html.Pager(Model.Projects.PageSize, Model.Projects.PageNumber, Model.Projects.TotalItemCount, new
{
    id = Model.Category != null ? Model.Category.ID : 0,
    cityid = Model.CityID.HasValue ? Model.CityID : 0,
    distrid = Model.DistrictID.HasValue ? Model.DistrictID : 0,
    key = Model.Keyword
})%>
    </div>
    <%}
      else
      { %>
    <div class="noresult">
        Dữ liệu đang được cập nhật</div>
    <%} %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="RightContent" runat="server">
    <%--<% Html.RenderAction("Search", "Project", new { id = Model.Category != null ? Model.Category.ID : 0, cityid = Model.CityID, distrid = Model.DistrictID, key=Model.Keyword }); %>--%>
    <div class="clear mar_t">
    </div>
    <% Html.RenderAction("Lasted", "Video", new { catid = 0, number = 3, title = string.Empty }); %>
    <div class="clear mar_t">
    </div>
    <% Html.RenderAction("HotByCat", "Project", new { number = 3, catid = Model.Category != null ? Model.Category.ID : 0, hotYN = 1, pubYN = 1, title = "Dự án nổi bật", prjorder = "ID", prjorderDir = "desc" }); %>
    <div class="clear">
    </div>
    <% Html.RenderAction("Focus", "Article", new { number = 5, skip = 0, catid = 0, title = "Tin tiêu điểm", order = "ID", orderDir = "desc" }); %>
    <div class="clear">
    </div>
    <% Html.RenderAction("Lasted", "Event", new { number = 3, catid = 0 }); %>
    <div class="clear">
    </div>
    <% Html.RenderAction("NewestByCat", "Article", new { number = 3, skip = 0, catid = SDT.Model.ConfigManager.GetChuyengiaPhantich(), title = "Chuyên gia phân tích", order = "ID", orderDir = "desc" }); %>
</asp:Content>
